#include "analy/branch/ToolBranchCT.h"

ToolBranchCT::ToolBranchCT(){
    QFont centraFont("KaiTi_GB2312", 10);
    definfc.batchFont({DT_scdtEdit, DT_rsdtEdit, BS_listWidget}, centraFont, 10);
    definfc.batchFont({CP_detialEdit, DT_rsview, DT_scview}, centraFont, 10);
    definfc.batchFont({QR_qrcodeLabel}, centraFont, 18);
    definfc.batchFont({QR_dataEdit, QR_keysEdit, QR_aliasEdit, QR_hintLabel}, centraFont, 10);
    definfc.batchFont({SP_usbportBut,SP_baudrateBut,SP_dtplaceBut,SP_stplaceBut,SP_ckplaceBut,SP_scontrolBut}, centraFont, 10);
    definfc.batchFont({SP_usbPortMenu, SP_baudRateMenu, SP_dtplaceMenu, SP_stplaceMenu, SP_ckplaceMenu, SP_scontrolMenu}, centraFont, 10);
    definfc.batchFont({SP_newlineCheckBox, SP_sensiticeCheck, SP_findBackward, SP_serialInfoEdit, SP_commandEdit, SP_hltextLabel,
                       SP_hlbkclLabel, SP_hlfrclLabel, SP_commandinputBut, SP_commandsaveBut, SP_commandsendBut, SP_ksubmitBut,
                       SP_hlsubmitBut, SP_baudrateBut, SP_ckplaceBut, SP_dtplaceBut, SP_usbportBut, SP_stplaceBut, SP_scontrolBut,}, centraFont, 10);
    definfc.batchFont({SP_hltextEdit, SP_hlbkclEdit, SP_hlfrclEdit}, centraFont, 10);
    definfc.batchFont({SPitem_viewNikeLB, SPitem_viewBaudLB, SPitem_viewDtplLB, SPitem_viewStplLB, SPitem_viewCheckLB, SPitem_viewStreamLB}, centraFont, 10);
    definfc.batchFont({SPitem_viewNikeV, SPitem_viewBaudV, SPitem_viewdataplV, SPitem_viewStopplV, SPitem_viewCheckV, SPitem_viewStreamV}, centraFont, 10);
    SP_TabWidget->tabBar(),

    DT_scview->setObjectName("DT_scview");
    DT_scview->doconfigur_brighttype(NT::DRAWTYPE_RECT, 3);
    DT_scview->doconfigur_fontgroup({{MSEVKEY.WIN_NORMAL, QFont("KaiTi_GB2312", 10)}});
    DT_scview->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(89,89,89)},
                                      {MSEVKEY.WIN_PRESS, QColor(255,255,255)}});
    DT_scview->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                          {MSEVKEY.WIN_PRESS, QColor(0,138,151)}});
    DT_scview->doconfigur_bordercolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                            {MSEVKEY.WIN_PRESS, QColor(255,92,92)}});
    DT_scview->doconfigur_textsetting(Qt::AlignCenter);


    DT_rsview->setObjectName("DT_rsview");
    DT_rsview->doconfigur_brighttype(NT::DRAWTYPE_RECT, 3);
    DT_rsview->doconfigur_fontgroup({{MSEVKEY.WIN_NORMAL, QFont("KaiTi_GB2312", 10)}});
    DT_rsview->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(89,89,89)},
                                      {MSEVKEY.WIN_PRESS, QColor(255,255,255)}});
    DT_rsview->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                          {MSEVKEY.WIN_PRESS, QColor(0,138,151)}});
    DT_rsview->doconfigur_bordercolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                            {MSEVKEY.WIN_PRESS, QColor(255,92,92)}});
    DT_rsview->doconfigur_textsetting(Qt::AlignCenter);


    DT_hlview->setObjectName("DT_hlview");
    DT_hlview->doconfigur_brighttype(NT::DRAWTYPE_RECT, 3);
    DT_hlview->doconfigur_fontgroup({{MSEVKEY.WIN_NORMAL, QFont("KaiTi_GB2312", 10)}});
    DT_hlview->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(89,89,89)},
                                      {MSEVKEY.WIN_PRESS, QColor(255,255,255)}});
    DT_hlview->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                          {MSEVKEY.WIN_PRESS, QColor(0,138,151)}});
    DT_hlview->doconfigur_bordercolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                            {MSEVKEY.WIN_PRESS, QColor(255,92,92)}});
    DT_hlview->doconfigur_textsetting(Qt::AlignCenter);


    DT_remove->doconfigur_brighttype(NT::DRAWTYPE_RECT, 3);
    DT_remove->doconfigur_fontgroup({{MSEVKEY.WIN_NORMAL, QFont("KaiTi_GB2312", 10)}});
    DT_remove->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(89,89,89)},
                                      {MSEVKEY.WIN_PRESS, QColor(255,255,255)}});
    DT_remove->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(255,255,255)},
                                          {MSEVKEY.WIN_PRESS, QColor(255,92,92)}});
    DT_remove->doconfigur_textsetting(Qt::AlignCenter);


    DT_multiFacehBox.addWidget(DT_scview);
    DT_multiFacehBox.addWidget(DT_rsview);
    DT_multiFacehBox.addWidget(DT_hlview);
    DT_multiFacehBox.addWidget(DT_remove);
    DT_multiFacehBox.setSpacing(3);


    DT_scdtEditAsClear->setFixedHeight(23);
    DT_scdtEditAsClear->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(64,64,64)},
                                                {MSEVKEY.WIN_ENTER, QColor(69,186,197)},
                                                {MSEVKEY.WIN_LEAVE, QColor(64,64,64)}});
    DT_scdtEditAsClear->doconfigur_pixmap(":/PIXMAP/bench/clear.png");
    DT_scdtEditAsClear->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 3);
    DT_scdtEditAsClear->doconfigur_brighttype(NT::DRAWTYPE_ROUND);
    DT_scdtEditAsClear->doconfigur_adjustedwidth(true);
    DT_scdtEditAsClear->setObjectName("DT_scdtEditAsClear");


    DT_rsdtEditAsClear->setFixedHeight(23);
    DT_rsdtEditAsClear->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(64,64,64)},
                                                {MSEVKEY.WIN_ENTER, QColor(69,186,197)},
                                                {MSEVKEY.WIN_LEAVE, QColor(64,64,64)}});
    DT_rsdtEditAsClear->doconfigur_pixmap(":/PIXMAP/bench/clear.png");
    DT_rsdtEditAsClear->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 3);
    DT_rsdtEditAsClear->doconfigur_brighttype(NT::DRAWTYPE_ROUND);
    DT_rsdtEditAsClear->doconfigur_adjustedwidth(true);
    DT_rsdtEditAsClear->setObjectName("DT_rsdtEditAsClear");

    DT_scdtEdit->addAssistFuncWidget(DT_scdtEditAsClear, NT::LOCALTION_BOTTON_RIGHT);
    DT_rsdtEdit->addAssistFuncWidget(DT_rsdtEditAsClear, NT::LOCALTION_BOTTON_RIGHT);
    DT_scdtEdit->setWordWrapMode(QTextOption::WrapAnywhere);
    DT_rsdtEdit->setWordWrapMode(QTextOption::WrapAnywhere);

    PBL_centraStackWidget->addWidget(DT_scdtEdit);
    PBL_centraStackWidget->addWidget(DT_rsdtEdit);
    PBL_centraStackWidget->addWidget(CP_Widget);
    PBL_centraStackWidget->addWidget(QR_Widget);
    PBL_centraStackWidget->addWidget(SP_Widget);

    //#AnlyTools
    BS_listWidget->setFocusPolicy(Qt::NoFocus);
    BS_listWidget->setFrameShape(QListWidget::NoFrame);
    CP_compareListWidget->setSelectionMode(QAbstractItemView::MultiSelection);
    CP_detialEdit->setWordWrapMode(QTextOption::WrapAnywhere);

    //# Compare Widget
    CP_compareListWidget->setSelectionMode(QAbstractItemView::MultiSelection);
    CP_detialEdit->setPlainText(CP_Format);
    CP_indexSubvBox->addWidget(CP_compareListWidget);
    CP_indexSubvBox->addWidget(CP_indexSubmit);;
    CP_globalhBox->addLayout(CP_indexSubvBox);
    CP_globalhBox->addWidget(CP_detialEdit);
    CP_Widget->setLayout(CP_globalhBox);

    //#QRcodeTools
    QR_dataEdit->setPlaceholderText("输入二维码数据(必填);");
    QR_aliasEdit->setPlaceholderText("输入二维码别名(非必填);");
    QR_keysEdit->setPlaceholderText("输入二维码密钥(非必填);");
    QR_hintLabel->setPenColor(QColor(125,125,125));

    QPalette palette;
    palette.setBrush(QPalette::Window, Qt::transparent);
    QR_areaWidget->setWidget(QR_qrcodeLabel);
    QR_areaWidget->setWidgetResizable(true);
    QR_areaWidget->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
    QR_areaWidget->setBackgroundRole(QPalette::Window);
    QR_areaWidget->setPalette(palette);
    QR_areaWidget->setFrameShape(QFrame::NoFrame);
    QR_areaWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    QR_qrcodeLabel->setAlignment(Qt::AlignCenter);

    QR_topWidget->setAttribute(Qt::WA_TranslucentBackground);
    QR_tophBox->addWidget(QR_modeCutBox);
    QR_tophBox->addWidget(QR_saveQrBox);
    QR_tophBox->addWidget(QR_saveBut);
    QR_topvBox->addLayout(QR_tophBox);
    QR_topvBox->addWidget(QR_hintLabel, 0, Qt::AlignBaseline);
    QR_topvBox->setSpacing(8);
    QR_topWidget->setLayout(QR_topvBox);

    QR_toolhBox->addWidget(QR_dataEdit);
    QR_toolhBox->addWidget(QR_keysEdit);
    QR_toolhBox->addWidget(QR_aliasEdit);

    QR_globalvBox->addWidget(QR_topWidget);
    QR_globalvBox->addWidget(QR_areaWidget);
    QR_globalvBox->addLayout(QR_toolhBox);
    QR_globalvBox->setContentsMargins(0,0,0,0);

    QR_dataEdit->setWordWrapMode(QTextOption::WrapAnywhere);
    QR_keysEdit->setWordWrapMode(QTextOption::WrapAnywhere);
    QR_aliasEdit->setWordWrapMode(QTextOption::WrapAnywhere);

    QR_Widget->setLayout(QR_globalvBox);

    //SPTools
    SerialErrorMap.insert(QSerialPort::DeviceNotFoundError, "试图打开不存在的设备时发生错误");
    SerialErrorMap.insert(QSerialPort::PermissionError, "试图打开已占用端口发生错误");
    SerialErrorMap.insert(QSerialPort::OpenError, "试图打开此对象中已打开的设备时发生错误");
    SerialErrorMap.insert(QSerialPort::NotOpenError, "设备串口未打开，执行异常");
    SerialErrorMap.insert(QSerialPort::WriteError, "写入数据时发生I/O错误");
    SerialErrorMap.insert(QSerialPort::ReadError, "读取数据时发生I/O错误");
    SerialErrorMap.insert(QSerialPort::ResourceError, "资源不可用");
    SerialErrorMap.insert(QSerialPort::UnsupportedOperationError, "当前操作系统不支持或不禁止所请求的设备操作");
    SerialErrorMap.insert(QSerialPort::TimeoutError, "超时错误");
    SerialErrorMap.insert(QSerialPort::UnknownError, "发生了一个无法识别的错误");

    portvBox->addWidget(SP_portLabel, 0, Qt::AlignCenter);
    portvBox->addWidget(SP_usbportBut, 0, Qt::AlignCenter);
    baudvBox->addWidget(SP_baudLabel, 0, Qt::AlignCenter);
    baudvBox->addWidget(SP_baudrateBut, 0, Qt::AlignCenter);
    dtbitsvBox->addWidget(SP_dtbitsLabel, 0, Qt::AlignCenter);
    dtbitsvBox->addWidget(SP_dtplaceBut, 0, Qt::AlignCenter);
    stbitsvBox->addWidget(SP_stbitsLabel, 0, Qt::AlignCenter);
    stbitsvBox->addWidget(SP_stplaceBut, 0, Qt::AlignCenter);
    ckplacevBox->addWidget(SP_ckPlaceLabel, 0, Qt::AlignCenter);
    ckplacevBox->addWidget(SP_ckplaceBut, 0, Qt::AlignCenter);
    scontrolvBox->addWidget(SP_scontrolLabel, 0, Qt::AlignCenter);
    scontrolvBox->addWidget(SP_scontrolBut, 0, Qt::AlignCenter);
    portvBox->setContentsMargins(0,0,0,0);
    baudvBox->setContentsMargins(0,0,0,0);
    dtbitsvBox->setContentsMargins(0,0,0,0);
    stbitsvBox->setContentsMargins(0,0,0,0);
    ckplacevBox->setContentsMargins(0,0,0,0);
    scontrolvBox->setContentsMargins(0,0,0,0);

    SP_usbportBut->setPopupMode(QToolButton::InstantPopup);
    SP_baudrateBut->setText("115200");
    SP_baudrateBut->setPopupMode(QToolButton::InstantPopup);
    SP_dtplaceBut->setText("bits 8");
    SP_dtplaceBut->setPopupMode(QToolButton::InstantPopup);
    SP_stplaceBut->setText("bits 1");
    SP_stplaceBut->setPopupMode(QToolButton::InstantPopup);
    SP_scontrolBut->setText("无控制");
    SP_scontrolBut->setPopupMode(QToolButton::InstantPopup);
    SP_ckplaceBut->setText("无校验");
    SP_ckplaceBut->setPopupMode(QToolButton::InstantPopup);

    SPitem_viewWidget->doconfigur_secolor(QColor(242,241,248));

    SP_portLabel->setObjectName("ooo");
    SP_portLabel->doconfigur_text("端口号");
    SP_baudLabel->doconfigur_text("波特率");
    SP_dtbitsLabel->doconfigur_text("数据位");
    SP_stbitsLabel->doconfigur_text("停止位");
    SP_ckPlaceLabel->doconfigur_text("校验位");
    SP_scontrolLabel->doconfigur_text("流控制");

    SP_portLabel->doconfigur_adjustedwidth(true);
    SP_baudLabel->doconfigur_adjustedwidth(true);
    SP_dtbitsLabel->doconfigur_adjustedwidth(true);
    SP_stbitsLabel->doconfigur_adjustedwidth(true);
    SP_ckPlaceLabel->doconfigur_adjustedwidth(true);
    SP_scontrolLabel->doconfigur_adjustedwidth(true);

    SP_portLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_baudLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_dtbitsLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_stbitsLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_ckPlaceLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_scontrolLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});

    SP_usbportBut->setMenu(SP_usbPortMenu);
    SP_baudrateBut->setMenu(SP_baudRateMenu);
    SP_dtplaceBut->setMenu(SP_dtplaceMenu);
    SP_stplaceBut->setMenu(SP_stplaceMenu);
    SP_ckplaceBut->setMenu(SP_ckplaceMenu);
    SP_scontrolBut->setMenu(SP_scontrolMenu);


    SP_serialEditAsClear->setFixedHeight(23);
    SP_serialEditAsClear->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(64,64,64)},
                                                     {MSEVKEY.WIN_ENTER, QColor(69,186,197)},
                                                     {MSEVKEY.WIN_LEAVE, QColor(64,64,64)}});
    SP_serialEditAsClear->doconfigur_pixmap(":/PIXMAP/bench/clear.png");
    SP_serialEditAsClear->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 3);
    SP_serialEditAsClear->doconfigur_brighttype(NT::DRAWTYPE_ROUND);
    SP_serialEditAsClear->doconfigur_adjustedwidth(true);
    SP_serialEditAsClear->setObjectName("SP_serialEditAsClear");


    SP_serialEditAsUpdater->setFixedHeight(23);
    SP_serialEditAsUpdater->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(64,64,64)},
                                                       {MSEVKEY.WIN_ENTER, QColor(69,186,197)},
                                                       {MSEVKEY.WIN_LEAVE, QColor(64,64,64)}});
    SP_serialEditAsUpdater->doconfigur_pixmap(":/PIXMAP/bench/update.png");
    SP_serialEditAsUpdater->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 3);
    SP_serialEditAsUpdater->doconfigur_brighttype(NT::DRAWTYPE_ROUND);
    SP_serialEditAsUpdater->doconfigur_adjustedwidth(true);
    SP_serialEditAsUpdater->setObjectName("SP_serialEditAsUpdater");


    SP_serialEditAsDownLoad->setFixedHeight(23);
    SP_serialEditAsDownLoad->doconfigur_backcolorgroup({{MSEVKEY.WIN_NORMAL, QColor(64,64,64)},
                                                        {MSEVKEY.WIN_ENTER, QColor(69,186,197)},
                                                        {MSEVKEY.WIN_LEAVE, QColor(64,64,64)}});
    SP_serialEditAsDownLoad->doconfigur_pixmap(":/PIXMAP/bench/download.png");
    SP_serialEditAsDownLoad->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 3);
    SP_serialEditAsDownLoad->doconfigur_brighttype(NT::DRAWTYPE_ROUND);
    SP_serialEditAsDownLoad->doconfigur_adjustedwidth(true);
    SP_serialEditAsDownLoad->setObjectName("SP_serialEditAsDownLoad");

    SP_serialInfoEdit->addAssistFuncWidget(SP_serialEditAsClear, NT::LOCALTION_BOTTON_RIGHT);
    SP_serialInfoEdit->addAssistFuncWidget(SP_serialEditAsUpdater, NT::LOCALTION_BOTTON_RIGHT);
    SP_serialInfoEdit->addAssistFuncWidget(SP_serialEditAsDownLoad, NT::LOCALTION_BOTTON_RIGHT);
    SP_serialInfoEdit->setAssistFuncWidgetLayoutClock(NT::CUT_ANTICLOCKWISE);
    SP_serialInfoEdit->setWheelFontBlock(25);
    SP_serialInfoEdit->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    SP_serialInfoEdit->setLineWidth(SP_serialInfoEdit->width());
    SP_serialInfoEdit->setContentsMargins(0, 0, 0, 0);
    SP_serialInfoEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    SP_ksearchEdit->setClearButtonEnabled(true);

    SP_usbPortMenu->setObjectName("SP_usbPortMenu");
    SP_baudRateMenu->setObjectName("SP_baudRateMenu");
    SP_dtplaceMenu->setObjectName("SP_dtplaceMenu");
    SP_stplaceMenu->setObjectName("SP_stplaceMenu");
    SP_ckplaceMenu->setObjectName("SP_ckplaceMenu");
    SP_scontrolMenu->setObjectName("SP_scontrolMenu");

    AS_baudr115200->setObjectName("AS_baudr115200");
    AS_baudr57600->setObjectName("AS_baudr57600");
    AS_baudr38400->setObjectName("AS_baudr38400");
    AS_baudr19200->setObjectName("AS_baudr19200");
    AS_baudr9600->setObjectName("AS_baudr9600");
    AS_baudr4800->setObjectName("AS_baudr4800");
    AS_baudr2400->setObjectName("AS_baudr2400");
    AS_baudr1200->setObjectName("AS_baudr1200");

    AS_oddParity->setObjectName("AS_oddParity");
    AS_evenParity->setObjectName("AS_evenParity");
    AS_unParity->setObjectName("AS_unParity");

    AS_dtbitsFive->setObjectName("AS_dtbitsFive");
    AS_dtbitsSix->setObjectName("AS_dtbitsSix");
    AS_dtbitsSeven->setObjectName("AS_dtbitsSeven");
    AS_dtbitsEight->setObjectName("AS_dtbitsEight->");

    AS_stbitsOne->setObjectName("AS_stbitsOne");
    AS_stbitshalf->setObjectName("AS_stbitshalf");
    AS_stbitsTwo->setObjectName("AS_stbitsTwo->");

    AS_hardControl->setObjectName("AS_hardControl");
    AS_softControl->setObjectName("AS_softControl");
    AS_unControl->setObjectName("AS_unControl");

    SP_baudRateMenu->addAction(AS_baudr115200);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr57600);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr38400);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr19200);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr9600);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr4800);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr2400);
    SP_baudRateMenu->addSeparator();
    SP_baudRateMenu->addAction(AS_baudr1200);

    SP_ckplaceMenu->addAction(AS_oddParity);
    SP_ckplaceMenu->addSeparator();
    SP_ckplaceMenu->addAction(AS_evenParity);
    SP_ckplaceMenu->addSeparator();
    SP_ckplaceMenu->addAction(AS_unParity);

    SP_scontrolMenu->addAction(AS_hardControl);
    SP_scontrolMenu->addSeparator();
    SP_scontrolMenu->addAction(AS_softControl);
    SP_scontrolMenu->addSeparator();
    SP_scontrolMenu->addAction(AS_unControl);

    SP_dtplaceMenu->addAction(AS_dtbitsFive);
    SP_dtplaceMenu->addSeparator();
    SP_dtplaceMenu->addAction(AS_dtbitsSix);
    SP_dtplaceMenu->addSeparator();
    SP_dtplaceMenu->addAction(AS_dtbitsSeven);
    SP_dtplaceMenu->addSeparator();
    SP_dtplaceMenu->addAction(AS_dtbitsEight);

    SP_stplaceMenu->addAction(AS_stbitsOne);
    SP_stplaceMenu->addSeparator();
    SP_stplaceMenu->addAction(AS_stbitshalf);
    SP_stplaceMenu->addSeparator();
    SP_stplaceMenu->addAction(AS_stbitsTwo);

    connectvBox->addWidget(SP_connectSqlSaveBut);
    connectvBox->addWidget(SP_connectSqlAlterBut);
    connectvBox->setSpacing(3);

    confighBox->addLayout(portvBox);
    confighBox->addLayout(baudvBox);
    confighBox->addLayout(dtbitsvBox);
    confighBox->addLayout(stbitsvBox);
    confighBox->addLayout(ckplacevBox);
    confighBox->addLayout(scontrolvBox);
    confighBox->addLayout(connectvBox, Qt::AlignCenter);
    confighBox->setSpacing(0);
    confighBox->setContentsMargins(3,0,3,0);
    SP_configWidget->setLayout(confighBox);

    SP_taskMap.insert(TIMER_TASK.SERIALFUNC_REBOOTIMER, {"ERROR.*\\(AT\\W+CIMI\\)\\s*failed.*status:\\d+"});

    SP_commandLvBox->addWidget(SP_commandsaveBut);
    SP_commandLvBox->addWidget(SP_commandinputBut);
    SP_commandRvBox->addWidget(SP_newlineCheckBox);
    SP_commandRvBox->addWidget(SP_commandsendBut);
    SP_commandhBox->addLayout(SP_commandLvBox, Qt::AlignCenter);
    SP_commandhBox->addWidget(SP_commandEdit);
    SP_commandhBox->addLayout(SP_commandRvBox);
    SP_commandhBox->setContentsMargins(3,0,3,0);
    SP_commandLvBox->setSpacing(3);

    SP_TabWidget->addTab(SP_configWidget, "串口信息");
    SP_TabWidget->addTab(SP_commandWidget, "发送数据");
    SP_TabWidget->addTab(SP_ksearchWidget, "字符搜索");
    SP_TabWidget->addTab(SP_hlightWidget, "高亮设置");
    SP_TabWidget->tabBar()->setExpanding(true);
    SP_TabWidget->setTabBarAutoHide(true);

    //# String Find
    SP_kcheckVbox->addWidget(SP_findBackward);
    SP_kcheckVbox->addWidget(SP_sensiticeCheck);
    SP_kcheckVbox->setSpacing(3);
    SP_ksearchHbox->addWidget(SP_ksearchEdit);
    SP_ksearchHbox->addWidget(SP_ksubmitBut);
    SP_ksearchHbox->addLayout(SP_kcheckVbox);
    SP_ksearchHbox->setContentsMargins(3,0,3,0);

    //# High Light
    SP_hltextHbox->addWidget(SP_hltextLabel);
    SP_hltextHbox->addWidget(SP_hlsubmitBut);
    SP_hltextVbox->addLayout(SP_hltextHbox);
    SP_hltextVbox->addWidget(SP_hltextEdit);
    SP_hlbkclVbox->addWidget(SP_hlbkclLabel);
    SP_hlbkclVbox->addWidget(SP_hlbkclEdit);
    SP_hlfrclVbox->addWidget(SP_hlfrclLabel);
    SP_hlfrclVbox->addWidget(SP_hlfrclEdit);

    SP_hlHbox->addLayout(SP_hltextVbox);
    SP_hlHbox->addLayout(SP_hlbkclVbox);
    SP_hlHbox->addLayout(SP_hlfrclVbox);
    SP_hltextHbox->setContentsMargins(3,0,3,0);
    SP_hltextVbox->setContentsMargins(0,3,0,3);
    SP_hlbkclVbox->setContentsMargins(0,3,0,3);
    SP_hlfrclVbox->setContentsMargins(0,3,0,3);
    SP_hlHbox->setContentsMargins(3,0,3,0);

    SP_hlsubmitBut->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);

    SP_hltextLabel->doconfigur_adjustedwidth(true);
    SP_hlbkclLabel->doconfigur_adjustedwidth(true);
    SP_hlfrclLabel->doconfigur_adjustedwidth(true);
    SP_hltextLabel->doconfigur_text("高亮文本");
    SP_hlbkclLabel->doconfigur_text("背景色");
    SP_hlfrclLabel->doconfigur_text("前景色");
    SP_hltextLabel->doconfigur_textsetting(Qt::AlignVCenter, QFont("KaiTi_GB2312", 13), QPoint(5,0));
    SP_hlbkclLabel->doconfigur_textsetting(Qt::AlignVCenter, QFont("KaiTi_GB2312", 13), QPoint(5,0));
    SP_hlfrclLabel->doconfigur_textsetting(Qt::AlignVCenter, QFont("KaiTi_GB2312", 13), QPoint(5,0));
    SP_hltextLabel->doconfigur_pixmap(":/PIXMAP/bench/high-light.png");
    SP_hlbkclLabel->doconfigur_pixmap(":/PIXMAP/bench/palette.png");
    SP_hlfrclLabel->doconfigur_pixmap(":/PIXMAP/bench/palette.png");
    SP_hltextLabel->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 1, QPoint(2,0));
    SP_hlbkclLabel->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 1, QPoint(2,0));
    SP_hlfrclLabel->doconfigur_imgsetting(NT::DRAWTYPE_RECT, NT::PIXLOAD_IGNORERATIO_LOWER, 1, QPoint(2,0));


    SP_hltextLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_hlbkclLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SP_hlfrclLabel->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});

    SP_globalGrid->addWidget(SP_serialInfoEdit, 0, 0, 13, 10);
    SP_globalGrid->addWidget(SP_TabWidget, 13, 0, 1, 10);
    SP_globalGrid->setContentsMargins(0,0,0,0);
    SP_globalGrid->setVerticalSpacing(0);

    SPitem_viewNikeLB->doconfigur_text("端口号");
    SPitem_viewBaudLB->doconfigur_text("波特率");
    SPitem_viewDtplLB->doconfigur_text("数据位");
    SPitem_viewStplLB->doconfigur_text("停止位");
    SPitem_viewCheckLB->doconfigur_text("校验位");
    SPitem_viewStreamLB->doconfigur_text("流控制");
    SPitem_viewNikeLB->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SPitem_viewBaudLB->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SPitem_viewDtplLB->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SPitem_viewStplLB->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SPitem_viewCheckLB->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});
    SPitem_viewStreamLB->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(84,130,55)}});

    SPitem_viewNikeV->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(12,12,12)}});
    SPitem_viewBaudV->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(12,12,12)}});
    SPitem_viewdataplV->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(12,12,12)}});
    SPitem_viewStopplV->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(12,12,12)}});
    SPitem_viewCheckV->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(12,12,12)}});
    SPitem_viewStreamV->doconfigur_colorgroup({{MSEVKEY.WIN_NORMAL, QColor(12,12,12)}});

    SPitem_porthBox->addWidget(SPitem_viewNikeLB, 0, Qt::AlignCenter);
    SPitem_porthBox->addWidget(SPitem_viewNikeV, 0, Qt::AlignCenter);
    SPitem_baudhBox->addWidget(SPitem_viewBaudLB, 0, Qt::AlignCenter);
    SPitem_baudhBox->addWidget(SPitem_viewBaudV, 0, Qt::AlignCenter);
    SPitem_dtbitshBox->addWidget(SPitem_viewDtplLB, 0, Qt::AlignCenter);
    SPitem_dtbitshBox->addWidget(SPitem_viewdataplV, 0, Qt::AlignCenter);
    SPitem_stbitshBox->addWidget(SPitem_viewStplLB, 0, Qt::AlignCenter);
    SPitem_stbitshBox->addWidget(SPitem_viewStopplV, 0, Qt::AlignCenter);
    SPitem_ckplacehBox->addWidget(SPitem_viewCheckLB, 0, Qt::AlignCenter);
    SPitem_ckplacehBox->addWidget(SPitem_viewCheckV, 0, Qt::AlignCenter);
    SPitem_scontrolhBox->addWidget(SPitem_viewStreamLB, 0, Qt::AlignCenter);
    SPitem_scontrolhBox->addWidget(SPitem_viewStreamV, 0, Qt::AlignCenter);
    SPitem_connectvBox->addLayout(SPitem_porthBox, Qt::AlignCenter);
    SPitem_connectvBox->addLayout(SPitem_baudhBox, Qt::AlignCenter);
    SPitem_connectvBox->addLayout(SPitem_dtbitshBox, Qt::AlignCenter);
    SPitem_connectvBox->addLayout(SPitem_stbitshBox, Qt::AlignCenter);
    SPitem_connectvBox->addLayout(SPitem_ckplacehBox, Qt::AlignCenter);
    SPitem_connectvBox->addLayout(SPitem_scontrolhBox, Qt::AlignCenter);
    SPitem_connectvBox->setContentsMargins(8,0,8,0);

    SPitem_connectvBox->setSpacing(2);
    SPitem_connectvBox->setContentsMargins(3,3,3,3);
    SPitem_viewNikeV->setEnabled(false);
    SPitem_viewBaudV->setEnabled(false);
    SPitem_viewdataplV->setEnabled(false);
    SPitem_viewStopplV->setEnabled(false);
    SPitem_viewCheckV->setEnabled(false);
    SPitem_viewStreamV->setEnabled(false);
    SPitem_viewWidget->setLayout(SPitem_connectvBox);
    SPitem_viewWidget->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
    SPitem_viewWidget->setVisible(false);

    MatchKeyWord->appendSpecialFormat(QColor(188,143,143), QColor(255,245,238));
    MatchKeyWord->appendGlobalFormat(QColor(255,245,238), QColor(188,143,143));

    SyntaxHLight->setDocument(SP_docuMent);

};


